package org.checkboo.hopefullyengine.light;

import java.nio.FloatBuffer;

import org.checkboo.hopefullyengine.sceneelements.Color;
import org.checkboo.math.Vector3f;
import org.lwjgl.BufferUtils;

public class DirectionalLight extends Light {

	private Vector3f direction;
	private FloatBuffer dir;
	
	public DirectionalLight(){
		super();
		this.direction = new Vector3f();
	}
	
	public DirectionalLight(Color diffuse, Color specular, Color ambient, Vector3f direction){
		super(diffuse, specular, ambient);
		this.direction = direction;
	}

	public Vector3f getDirection() {
		return direction;
	}

	public void setDirection(Vector3f direction) {
		this.direction = direction;
	}
	
	public FloatBuffer getDirectionBuffer(){
		if(null == dir)
			dir = BufferUtils.createFloatBuffer(4);
		dir.put(this.direction.getX()).put(this.direction.getY()).put(this.direction.getZ()).put(0.0f).rewind();
		return dir;
	}
}
